package cn.gson.springboot.model.service;

import cn.gson.springboot.model.dao.CollectionRecordDao;
import cn.gson.springboot.model.mapper.CollectionRecordMapper;
import cn.gson.springboot.model.pojos.Collectionrecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class CollectionRecordService {
    @Autowired
    CollectionRecordMapper collectionRecordMapper;
    @Autowired
    CollectionRecordDao collectionrecordDao;
   /* public List<Collectionrecord> selectEmpCollectionRecord(Integer deptId) {
        return collectionRecordMapper.selectEmpCollectionRecord(deptId);
    }*/

    public List<Collectionrecord> selectEmpCollectionRecordByPays(Integer deptId,Integer collectionrecordPaystyle) {
        return collectionRecordMapper.selectEmpCollectionRecordByPays(deptId,collectionrecordPaystyle);
    }

    public List<Collectionrecord> selectEmpCollectionRecordBySort(Integer deptId,Integer collectionrecordSort) {
        return collectionRecordMapper.selectEmpCollectionRecordBySort(deptId,collectionrecordSort);
    }

    public List<Collectionrecord> selectEmpCollectionRecordByInvoiced(Integer deptId,Integer collectionrecordInvoiced) {
        return collectionRecordMapper.selectEmpCollectionRecordByInvoiced(deptId,collectionrecordInvoiced);
    }

    public List<Collectionrecord> selectEmpCollectionRecordByDate(Integer deptId,String collectionrecordDate) {
        return collectionRecordMapper.selectEmpCollectionRecordByDate(deptId,collectionrecordDate);
    }

    public List<Collectionrecord> selectEmpCollectionRecordByCusName(Integer deptId,String customerName) {
        return collectionRecordMapper.selectEmpCollectionRecordByCusName(deptId,customerName);
    }

    @Transactional(transactionManager = "transactionManager")
    public void saveCollectionRecords(Collectionrecord collectionrecord){
        collectionrecordDao.save(collectionrecord);
    }

    @Transactional(transactionManager = "transactionManager")
    public void deleteCollectionRecords(Integer collectionrecordId){
        collectionrecordDao.deleteById(collectionrecordId);
    }

    public List<Collectionrecord> selectCollectionRecordsByConId(Integer conId) {
        return collectionRecordMapper.selectCollectionRecordsByConId(conId);
    }

    public List<Collectionrecord> selectEmpCollectionRecord(int deptId, int empId, Integer value, Integer num, Integer vague, String content) {
        return  collectionRecordMapper.selectEmpCollectionRecord(deptId,empId,value,num,vague,content);
    }
}
